/*
Plus One

Given a non-negative number represented as an array of digits, plus one to the number.

The digits are stored such that the most significant digit is at the head of the list.

*/

#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <stack>
#include <fstream>
#include <sstream>
#include "print.h"
using namespace std;


void testForStack()
{
	stack<int> mystack;
	mystack.push(10);
	mystack.push(20);
	mystack.top() -= 5;
	cout << "mystack.top() is now " << mystack.top() << endl;
}

void testForIntToString()
{
	int a = 10;
	stringstream ss;
	ss << a;
	string str = ss.str();
	cout << str << endl;

	string str1 = to_string(a);

}


class Solution {
public:
	vector<int> plusOne(vector<int> &digits) {

		vector<int> results;

		int temp = 1;
		for (int i = digits.size() - 1; i >= 0; i--) {
			temp += digits[i];
			results.insert(results.begin(), temp % 10);
			temp = temp / 10;
		}
		if (temp > 0) {
			results.insert(results.begin(), temp);
		}
		return results;
	}
};
int main(int argc, char* argv[])
{

	testForIntToString();
	Solution s;
	char *word = "";
	for (int i = 1; i < argc; i++){

		cout << argv[i] << endl;
		//arrInt[i - 1] = atoi(argv[i]);
		//str = argv[i];
		//charPtr = argv[i];
		//fileName = argv[i];
		word = argv[i];

	}

	word = "a ";
	cout << strlen(word) << endl;
	cout << word[0] << endl;
	cout << "lengthOfLastWord: " << s.lengthOfLastWord(word) << endl;



	system("pause");
	return 0;
}